from Case.python_ui.Common.do_mysql import DoMysql


class GetSqlObject(object):

    __instance = None

    def __init__(self,cmdopt):
        if GetSqlObject.__instance is not None:
            raise Exception("This class is a singleton!")
        self.do_mysql = DoMysql(cmdopt).databases()
        GetSqlObject.__instance = self

    @staticmethod
    def get_instance(cmdopt):
        if GetSqlObject.__instance is None:
            GetSqlObject.__instance = GetSqlObject(cmdopt)
        return GetSqlObject.__instance.do_mysql
    # @Staticmethod

if __name__ == "__main__":
    print(GetSqlObject.get_instance("sit"))
    print(GetSqlObject.get_instance("sit"))